import useStorage from './useStorage'

export default function useCounter(val) {
  const count = useStorage('count', val)

  const add = () => {
    count.value++
  }

  const sub = () => {
    count.value--
  }

  return {
    count,
    add,
    sub,
  }
}
